package com.glc.hms.common.constant;



/**
 * @Description: Enum的演示
 * @Author: ljt
 * @CreateTime: 2019-11-21 21:56
 */
public enum DemoEnum implements IBaseCodeEnum<DemoEnum>{

    /**
     * 一
     */
    ONE("ONE","一"),
    /**
     * 二
     */
    TWO("TWO","二");

    private String code;
    private String name;

    DemoEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }
    @Override
    public String getName() {
        return name;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public DemoEnum fromCode(String code) {
        for (DemoEnum typeEnum : DemoEnum.values()) {
            if (typeEnum.getCode().equals(code)) {
                return typeEnum;
            }
        }
        return null;
    }

    @Override
    public DemoEnum fromName(String name) {
        for (DemoEnum typeEnum : DemoEnum.values()) {
            if (typeEnum.getCode().equals(name)) {
                return typeEnum;
            }
        }
        return null;
    }


}























